<template>
	<view>
		<uni-easyinput v-model="city" placeholder="请输入城市" />
		<button type="default" @click="changeCity">确认修改</button>
	</view>
</template>

<script>
export default {
	data() {
		return {
			city: '',
			val: 0
		};
	},
	methods: {
		changeCity() {
			if (this.city) {
				let _this = this;
				setInterval(() => {
					_this.val++;
					uni.$emit('changeAddress', { msg: this.city + _this.val });
				}, 1000);
				uni.navigateBack({
					delta: 1
				});
			} else {
				uni.showToast({
					title: '请写个城市',
					icon: 'none'
				});
			}
		}
	}
};
</script>

<style></style>
